summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/(system)/email-template/page.tsx
blob: c44379944fe603828c3ec7cc7c938c1cf2a9097c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import * as React from "react"
import { type Metadata } from "next"
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import { getTemplateList } from "@/lib/email-template/service"
import { type SearchParams } from "@/types/table"
import { SearchParamsEmailTemplateCache } from "@/lib/email-template/validations"
import { TemplateTable } from "@/lib/email-template/table/email-template-table"
import { Shell } from "@/components/shell"
import { getValidFilters } from "@/lib/data-table"
import { Skeleton } from "@/components/ui/skeleton"
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
import { useTranslation } from "@/i18n"

export const metadata: Metadata = {
  title: "템플릿 관리",
  description: "이메일 템플릿을 관리하고 편집합니다.",
}

interface TemplatePageProps {
  params: Promise<{ lng: string }>
  searchParams: Promise<SearchParams>
}

export default async function TemplatePage(props: TemplatePageProps) {
  const { lng } = await props.params
  const { t } = await useTranslation(lng, 'menu')

  const searchParams = await props.searchParams

  const search = SearchParamsEmailTemplateCache.parse(searchParams)
  const validFilters = getValidFilters(search.filters)


  const promises = Promise.all([
    getTemplateList({
      ...search,
      filters: validFilters,
    }),

  ])

  return (

    <Shell className="gap-2">
      <div className="flex items-center justify-between space-y-2">
        <div className="flex items-center justify-between space-y-2">
          <div>
            <div className="flex items-center gap-2">
              <h2 className="text-2xl font-bold tracking-tight">
                {t('menu.information_system.email_template')}
              </h2>
              {/* <InformationButton pagePath="evcp/equip-class" /> */}
            </div>
          </div>
        </div>
      </div>

      <React.Suspense fallback={<Skeleton className="h-7 w-52" />}>
      </React.Suspense>
      <React.Suspense
        fallback={
          <DataTableSkeleton
            columnCount={6}
            searchableColumnCount={1}
            filterableColumnCount={2}
            cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]}
            shrinkZero
          />
        }
      >
        <TemplateTable promises={promises} />
      </React.Suspense>
    </Shell>
  )
}